<template>
  <div id="app">
    <div class="nav">
      <router-link tag="div" class="nav-link" to="/login">登录</router-link>
      <router-link tag="div" class="nav-link" to="/register">注册</router-link>
      <div class="async-link" v-if="$store.state.isLogin">
        <router-link tag="div" class="nav-link" to="/dashboard">Dashboard</router-link>
      </div>
    </div>
    <h1>动态添加路由</h1>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  
};
</script>

<style>
body {
  margin: 0;
}

#app {
  text-align: center;
}

.nav {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  height: 44px;
  background-color: #424242;
}

.nav-link {
  width: 100px;
  height: 100%;
  text-align: center;
  line-height: 44px;
  color: #fff;
}
</style>
